package com.shine.app.commons;

import java.text.DecimalFormat;

public class DoubleUtils {

	public static String formatPrice(double input) {
		String price = format(input, 2);
		price = "$" + price;
		return price;
	}

	public static String format(double input, int length) {
		DecimalFormat decimalFormat = new DecimalFormat();
		decimalFormat.setMaximumFractionDigits(length);
		decimalFormat.setMinimumFractionDigits(length);
		return decimalFormat.format(input);
	}

	public static String toInt(double input) {
		String result = "";
		DecimalFormat decimalFormat = new DecimalFormat("0");
		result = decimalFormat.format(input);
		return result;
	}

}
